package cn.kingyea.bigdata.hive;

import org.junit.Test;

import cn.kingyea.utils.ApacheHiveUtils;
import cn.kingyea.utils.HiveUtils;

public class HiveTestUtils {
//	public static void main(String[] args) {
////		Object result = HiveUtils.executeQuery("select * from test1");
//		
//		String createSql = "create table test1(id int, name string)row format delimited fields terminated by '\t'";
//		Object rs = HiveUtils.executeUpdate(createSql);
//		
//		String insert = "insert into test1 select * from test2 ";
////		Object rs = HiveUtils.executeUpdate(insert);
//		
//		String drop = "drop table test2";
////		Object rs = HiveUtils.executeUpdate(drop);
//		System.out.println("sss: "+rs);
//	}
	
	
	@Test
	public void testApacheHive() throws Exception{
		//默认：create table rc_t1(id string) stored as rcfile;
		//create table test_txt(id int, name string)row format delimited fields terminated by '\t' stored as textfile;
		//华为默认使用的是rcfile来进行数据保存。
		String sql = "create table test1(id int, name string)row format delimited fields terminated by '\t'";
		sql = "select * from test1";
//		Object rs = ApacheHiveUtils.executeUpdate(sql);
//		Object rs = HiveUtils.executeUpdate(sql);
		Object rs = HiveUtils.executeQuery(sql);
		
		System.err.println(rs);
	}
	
	
	
	
}
